import request from "@/utils/request";

export interface IAddCartItem {
  userid: string,
  proid: string,
  num: number
}

export interface IUpdateCartItem {
  cartid: string,
  num: number
}

export interface IUpdateCartItemFlag {
  cartid: string,
  flag: boolean
}

export interface IUpdateAllCartItemFlag {
  userid: string,
  type: boolean
}
import type {ICartItem} from '@/@types/cart'
export const postCartListApi = (userid: string) => request.post<any,ICartItem[]>('/cart/list', { userid }, { silent: true })
export const postAddCartItemApi = (params: IAddCartItem) => request.post<any, null>('/cart/add', params)
export const postUpdateCartNumApi = (params: IUpdateCartItem) => request.post<any, null>('/cart/updatenum', params)
export const postmoveCartItemApi = (cartid: string) => request.post<any, null>('/cart/remove', { cartid })
export const postUpdateCartItemFlagApi = (params: IUpdateCartItemFlag) => request.post<any, null>('/cart/selectone', params)
export const postUpdateAllCartItemFlagApi = (params: IUpdateAllCartItemFlag) => request.post<any, null>('/cart/selectall', params)
 